package com.itheima.homework.test4;

/**
 * @author jiangxun
 * @date 11-19-2024
 */
public class Computer{
    public void use(USB usb){
        usb.connect();
        if(usb instanceof KeyBoard) {
            ((KeyBoard) usb).type();
        }else if(usb instanceof Mouse){
            ((Mouse) usb).click();
        }
        usb.exit();
    }
}
